<template>
  <div class="hello">
    <app-header v-on:titleChange="updateTitle($event)" v-bind:fyf="fff"></app-header>
    <yang v-bind:yyy="people"></yang>
    <app-footer></app-footer>
  </div>
</template>

<script>
  import Yang from './Yang'
  import Header from './Header'
  import Footer from './Footer'
  export default {
    components: {
      "app-header": Header,
      "yang": Yang,
      "app-footer": Footer
    },
    name: 'home',
    data () {
      return {
        people: [],
        fff: "fangyifei"
      }
    },

    methods: {
      updateTitle(titleTwo){
        this.fff = titleTwo
      }
    },
    created(){
      this.$http.get("http://jsonplaceholder.typicode.com/users")
        .then((data) => {//请求成功调用.then
          this.people = data.body;
        })
    }
  }


</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
  h1, h2 {
    font-weight: normal;
  }

  ul {
    list-style-type: none;
    padding: 0;
  }

  li {
    display: inline-block;
    margin: 0 10px;
  }

  a {
    color: #42b983;
  }
</style>
